package com.itcoon.transform.base.definition;

import java.lang.reflect.Method;

/**
 * transform 目标描述
 */
public class ModelPropertyDefinition {

    /**
     * 转换域映射的源属性值
     */
    private String originAttribute;

    /**
     * 转换域源的getter方法
     */
    private Method originGetter;

    /**
     * 转换羽的源的返回类型
     */
    private Class<?> originPropertyType;

    /**
     * 转换域目标属性值
     */
    private String targetAttribute;

    /**
     * 转换域目标类型
     */
    private Class<?> targetPropertyType;

    /**
     * 转换域目标属性getter方法
     */
    private Method targetGetter;


    private Boolean annotated;

    /**
     * 转换域目标属性setter方法
     */
    private Method targetSetter;

    /**
     * 从属于的转换模型信息对象
     */
    private final ModelDefinition parent;

    public ModelPropertyDefinition(ModelDefinition parent) {
        this.parent = parent;
    }


    public String getOriginAttribute() {
        return originAttribute;
    }

    public void setOriginAttribute(String originAttribute) {
        this.originAttribute = originAttribute;
    }

    public Method getOriginGetter() {
        return originGetter;
    }

    public void setOriginGetter(Method originGetter) {
        this.originGetter = originGetter;
    }

    public String getTargetAttribute() {
        return targetAttribute;
    }

    public void setTargetAttribute(String targetAttribute) {
        this.targetAttribute = targetAttribute;
    }

    public Method getTargetGetter() {
        return targetGetter;
    }

    public void setTargetGetter(Method targetGetter) {
        this.targetGetter = targetGetter;
    }

    public Method getTargetSetter() {
        return targetSetter;
    }

    public void setTargetSetter(Method targetSetter) {
        this.targetSetter = targetSetter;
    }

    public Class<?> getTargetPropertyType() {
        return targetPropertyType;
    }

    public void setTargetPropertyType(Class<?> targetPropertyType) {
        this.targetPropertyType = targetPropertyType;
    }

    public ModelDefinition getParent() {
        return parent;
    }

    public Class<?> getOriginPropertyType() {
        return originPropertyType;
    }

    public void setOriginPropertyType(Class<?> originPropertyType) {
        this.originPropertyType = originPropertyType;
    }

    public Boolean getAnnotated() {
        return annotated;
    }

    public void setAnnotated(Boolean annotated) {
        this.annotated = annotated;
    }

    @Override
    public String toString() {
        return "ModelPropertyDefinition{" +
                "originAttribute='" + originAttribute + '\'' +
                ", originGetter=" + originGetter +
                ", originPropertyType=" + originPropertyType +
                ", targetAttribute='" + targetAttribute + '\'' +
                ", targetPropertyType=" + targetPropertyType +
                ", targetGetter=" + targetGetter +
                ", annotated=" + annotated +
                ", targetSetter=" + targetSetter +
                ", parent=" + parent +
                '}';
    }
}
